package practise2;

public class Animal {
    private String name;
    private int legnum;

    public String getName() {
        return name;
    }

    public int getLegnum() {
        return legnum;
    }

    public Animal(String name, int legnum){
        this.name=name;
        this.legnum=legnum;
    }

    public void shout(){
        if (this instanceof Cat){
            System.out.println("喵喵喵......");
        }else if (this instanceof Duck){
            System.out.println("嘎嘎嘎......");
        }else{
            System.out.println("无");
        }
    }
}
